package com.log320.huffman;

import java.util.ArrayList;
import java.util.LinkedList;

/**
 * Implementation of the BinaryComponent class that represent a node containing
 * a character. It does not have any children.
 *
 */
public class BinaryLeaf extends BinaryComponent{
	public BinaryLeaf(int character, int frequecy) {
		super(character, frequecy);
	}
/**
 * Method used to build an array of characters associated to their binary value.
 */
	@Override
	public void buildLeafArray(ArrayList<BinaryCode> bitArray,LinkedList<Boolean> tempBitArray) {
		bitArray.set(character, new BinaryCode(character,tempBitArray));
	}
/**
 * decode the stream
 * @param stream	the bitstream
 * @return value representing the value of the byte that was encoded
 */
	public int Decode(BitInputStream stream){
		return character;
	};
}
